<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Random Link</title>
</head>
<body>
<p id="demo">随机链接</p>
<script>
    var v = Math.random();
    var x = document.getElementById("demo")
    if (v < 0.5){
        x.innerHTML = "<a href = \"http://www.baidu.com\">随机链接<a/>";
    } else {
        x.innerHTML = "<a href = 'http://www.google.com'>随机链接<a/>"
    }
</script>
</body>
</html>